package com.yan.common.mq;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.support.CorrelationData;

/**
 * Created by yanl_ on 2018/4/17.
 */
public class MsgSendConfirmCallBack implements RabbitTemplate.ConfirmCallback {

    private static Logger logger = LoggerFactory.getLogger(MsgSendConfirmCallBack.class);

    @Override
    public void confirm(CorrelationData correlationData, boolean ack, String cause) {
        if (ack) {
            logger.info("message send success:{}", correlationData);
        } else {
            logger.error("message send fail:{},  cause:{}", correlationData, cause);

        }
    }
}